#include<iostream>
using namespace std;

double pow(double x, int n){
    if(n == 0) 
        return 1;

    double p = pow(x, n/2);    
    if((n & 1) == 0)       //判断n的二进制表示的最后一位是否为0
        return p * p;
    else
        return p * p * x;
}

int main(){
    double x;
    int n;
    cout << "请输入一个实数作为底数：";
    cin >> x;
    cout << "请输入一个非负整数作为幂：";
    cin >> n;
    cout << x << "的" << n << "次幂为：" << pow(x , n) << endl;
    return 0;
}